from typing import List

import pytest


def pytest_collection_modifyitems(
        session: "Session", config: "Config", items: List["Item"]
) -> None:
    for item in items:
        item.name = item.name.encode('utf-8').decode('unicode-escape')
        item._nodeid = item.nodeid.encode('utf-8').decode('unicode-escape')
        print(f"nodeid = {item.nodeid}")
        print(f"path = {item.fspath.strpath}")
    for item in items:
        if item.nodeid.endswith("test_parametrize"):
            # 获取原始参数化参数
            original_param = item.get_closest_marker("parametrize").args[0]

            # 修改参数列表的显示格式
            modified_param = original_param.split(", ")
            # modified_param = [str(lst) for lst in original_param]
            item.add_marker(pytest.param(*modified_param, marks=item.get_closest_marker("parametrize").args[0]))
